//Eg4-15.cpp
#include <iostream>
using namespace std;
class Base1{
private:
    int x;
public:
    Base1(int a=1){
        x=a;
        cout<<"Base1 constructor x="<<x<<endl;
    }
    ~Base1(){ cout<<"Base1 destructor..."<<endl; }
};
class Base2{
private:
    int y;
public:
    Base2(int a){
        y=a;
        cout<<"Base2 constructor y="<<y<<endl;
    }
    ~Base2(){ cout<<"Base2 destructor..."<<endl; }
};
class Base3{
private:
    int z;
public:
    Base3(int a){
        z=a;
        cout<<"Base3 constructor z="<<z<<endl;
    }
    ~Base3(){ cout<<"Base3 destructor..."<<endl; }
};
class Derived:public  Base1,protected Base2,private Base3{
private:
    int y;
public:
    Derived(int a,int b,int c):Base3(b),Base2(a){
        y=c;
        cout<<"Derived constructor y="<<y<<endl;
    }
    ~Derived(){ cout<<"Derived destructor..."<<endl; }
};
void main(){
    Derived d(2,3,4);
}
